package sctu.edu.java.year2016.team01.xuhanmei.day20160524.practice4;

/**
 * Created by Administrator on 2016/5/24.
 */
import java.util.regex.Pattern;
public class ChineseAmount {
    public static void main(String[] args) {
        String text="死生契阔，与子成说。ssqk,yzcs";
        int amount=0;
        for(int i=0;i<text.length();i++){
            boolean matches=Pattern.matches("^[\u4E00-\u9FA5]{0,}$",""+text.charAt(i));
            if (matches) {
                amount++;
            }
        }
        System.out.println("这句话中一共有"+amount+"个汉字");
    }
}
